﻿// 对Date的扩展，将 Date 转化为指定格式的String   
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符，   
// 年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字)   
// 例子：   
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423   
// (new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18   
Date.prototype.Format = function(fmt)   
{  
  var o = {   
    "M+" : this.getMonth()+1,                 //月份   
    "d+" : this.getDate(),                    //日   
    "h+" : this.getHours(),                   //小时   
    "m+" : this.getMinutes(),                 //分   
    "s+" : this.getSeconds(),                 //秒   
    "q+" : Math.floor((this.getMonth()+3)/3), //季度   
    "S"  : this.getMilliseconds()             //毫秒   
  };   
  if(/(y+)/.test(fmt))   
    fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));   
  for(var k in o)   
    if(new RegExp("("+ k +")").test(fmt))   
  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));   
  return fmt;   
}
//yyyy-MM-dd hh:mm:ss
function stringToDate(strDate) {
    var tempStrs = strDate.split(" ");

    var dateStrs = tempStrs[0].split("-");
    var year = parseInt(dateStrs[0], 10);
    var month = parseInt(dateStrs[1], 10) - 1;
    var day = parseInt(dateStrs[2], 10);

    var timeStrs = tempStrs[1].split(":");
    var hour = parseInt(timeStrs [0], 10);
    var minute = parseInt(timeStrs[1], 10);
    var second = parseInt(timeStrs[2], 10);

    var date = new Date(year, month, day, hour, minute, second);
    return date;
}



var newDiv = document.createElement("div");
newDiv.style.position = "fixed";
newDiv.style.zIndex = "9999";
newDiv.style.width = "100%";
newDiv.style.height = "35px";
newDiv.style.bottom = "5px";
newDiv.style.left = 'p'; // 屏幕居中
newDiv.style.backgroundColor = "#fff";
newDiv.style.border = "0px solid #860001";
newDiv.style.padding = "0";

var s=pageIndex==1;

newDiv.appendChild(getDiv(s,"Oders Plan",function(){
	location.href="so.htm"
}));

newDiv.appendChild(getDiv(pageIndex==2,"Production",function(){
	location.href="lm.htm"
}));

newDiv.appendChild(getDiv(pageIndex==4,"Prod. Record",function(){
 location.href="detailHis.htm"
}));
newDiv.appendChild(getDiv(pageIndex==5,"金点子提案",function(){
   location.href="jdz.htm"
}));

newDiv.appendChild(getDiv(pageIndex==7,"项目管理",function(){
   location.href="manage.htm"
}));
newDiv.appendChild(getDiv(pageIndex==100,"Quality",function(){
  alert("研发中")
}));
newDiv.appendChild(getDiv(pageIndex==101,"Maintenance",function(){
  alert("研发中")
}));
newDiv.appendChild(rightDiv());

document.body.appendChild(newDiv);

function getDiv(select,show,fun){
	
		var div2 = document.createElement("div");
		div2.style.height = "30px";
		div2.style.width = "125px";
		div2.style.float="left"
		div2.style.marginTop="1px"
		
	div2.style.border="2px solid rgb(31, 92, 80)"
 
    div2.style. borderRadius="6px";
		if(select){
				div2.style.backgroundColor = "rgb(61, 61, 222)";
				
		}else{
				div2.style.backgroundImage="linear-gradient(to right,  #25aae1, #25aae1)";
			  
		}

		div2.style.marginLeft="8px"
		div2.style.textAlign="center"
		div2.style.lineHeight="30px"
		div2.style.alignItems="center";
		div2.style.display="flex"; 
		div2.style.justifyContent="center";
				div2.style.fontSize="20px";
		div2.onclick=fun;
		div2.innerHTML=show
	  return div2;
}

function rightDiv(){
		var div2 = document.createElement("div");
		div2.id="nowTime"
		div2.style.height = "35px";
		
		div2.style.float="right"
		div2.style.color ="rgb(61, 61, 222)";
		div2.style.marginLeft="10px"
		div2.style.textAlign="right"
		div2.style.lineHeight="32px"
		
		div2.style.alignItems="center";
		div2.style.display="flex"; 
		div2.style.justifyContent="center";
		


	  return div2;
}

function setTime(){
	 var d=new Date()
	 //document.getElementById("nowTime").innerHTML=d.Format("MM-dd hh:mm:ss");
	
	}
	
	
	function getlabel(all,type,value){
		
		 for(var i=0;i<all.length;i++){
				if(all[i].dType==type&&all[i].type=="1"){
 						if(all[i].value==value){
 							
 									return all[i].label;
 							 
 						}	
 					}
			}
			
			return value;
 	 						
}